package ru.dc.object.commands;

import org.apache.commons.lang.StringUtils;

import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

/**
 * Created by IntelliJ IDEA.
 * User: deady
 * Date: 08.10.2010
 * Time: 23:07:31
 * To change this template use File | Settings | File Templates.
 */
public class NickList extends Command {

    private String[] users;

    @Override
    public String getActualCommandName() {
        return "$NickList";
    }

    @Override
    public String generateCommand() {
        return getActualCommandName()+" "+ StringUtils.join(users, "$$");
    }

    @Override
    public void parseCommand() {
        if (getCommand().length()>10) {
            String nicks = getCommand().substring(10);
            users = nicks.split("\\$\\$");
        }
        else {
            users = null;
        }
    }

    public String[] getUsers() {
        return users;
    }
}
